package com.heng.futureDemo;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class ACompletableFutureDemo1 {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        FutureTask<String> stringFutureTask = new FutureTask<>(new MyThead()); //构造注入！

        Thread t1 = new Thread(stringFutureTask,"t1");
        t1.start();

        System.out.println(stringFutureTask.get());
    }
}

class MyThead implements Callable<String> {
    public String call() throws Exception{
        System.out.println("----come in call() ");
        return "hello Callable";
    }
}
